
Hi all, I'm going crazy trying to get Alex to do what I want. I have the following regexp macros: @octEscape = [0123]? $octdig{1,2} @hexEscape = 'u' $hexdig{4} @charEscape = '\\' (@octEscape | @hexEscape | b | t | n | f | r | \" | \') and the following rules: \' (. # [\'\\] | @charEscape) \' { \p s -> CharTok (readCharTok s) } \" (. # [\"\\] | @charEscape)* \" { \p s -> StringTok (readStringTok s) } I've tried a lot of variations on where to put the backslashes and quotes to get it to do what I want, what you see above is just one variation, but no matter what I try I can't get it to work.
alexScanTokens $ show '\n' *** Exception: lexical error
Can anyone help shed some light on this for me? Why can't I get alex to recognize escapes inside character literals? Cheers, /Niklas