blob: 2fb0edce0fb39f38303379cf1f74a63908d2b844 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
-- !!! Testing the behaviour of Char.lexLitChar a little..
-- [March 2003] We now allow \X and \O as escapes although the
-- spec only permits \x and \o. Seems more consistent.
module Main where
import Data.Char
lex' str = do
putStr ("lex " ++ str ++ " = ")
print (lex str)
hexes = do
lex' "'\\X00'"
lex' "'\\x0f2'"
lex' "'\\xf2'"
lex' "'\\xf2t'"
lex' "'\\X24'"
lex' "'\\x24b'"
lex' "'\\Xa4b'"
lex' "'\\xa4bg'"
octs = do
lex' "'\\o00'"
lex' "'\\o05'"
lex' "'\\o50'"
lex' "'\\o72'"
lex' "'\\o82'"
lex' "'\\O24'"
lex' "'\\O000024'"
lex' "'\\024b'"
lex' "'\\o14b'"
lex' "'\\0a4bg'"
main = do
hexes
octs
|