|
11 | 11 |
|
12 | 12 | { |
13 | 13 | module Main (main) where |
14 | | -import Data.Char (chr) |
| 14 | +import Data.Char (chr, ord) |
15 | 15 | } |
16 | 16 |
|
17 | 17 | %wrapper "monad" |
@@ -39,7 +39,7 @@ $idchar = [$alpha $digit \'] |
39 | 39 | $symchar = [$symbol \:] |
40 | 40 | $nl = [\n\r] |
41 | 41 |
|
42 | | -@reservedid = |
| 42 | +@reservedid = |
43 | 43 | as|case|class|data|default|deriving|do|else|hiding|if| |
44 | 44 | import|in|infix|infixl|infixr|instance|let|module|newtype| |
45 | 45 | of|qualified|then|type|where |
@@ -88,7 +88,7 @@ haskell :- |
88 | 88 | <0> @varsym { mkL LVarSym } |
89 | 89 | <0> @consym { mkL LConSym } |
90 | 90 |
|
91 | | -<0> @decimal |
| 91 | +<0> @decimal |
92 | 92 | | 0[oO] @octal |
93 | 93 | | 0[xX] @hexadecimal { mkL LInteger } |
94 | 94 |
|
@@ -121,7 +121,7 @@ data LexemeClass |
121 | 121 | | LQConSym |
122 | 122 | | LEOF |
123 | 123 | deriving Eq |
124 | | - |
| 124 | +
|
125 | 125 | mkL :: LexemeClass -> AlexInput -> Int -> Alex Lexeme |
126 | 126 | mkL c (p,_,_,str) len = return (L p c (take len str)) |
127 | 127 |
|
@@ -149,17 +149,17 @@ nested_comment _ _ = do |
149 | 149 | Just (c,input) -> go n input |
150 | 150 | c -> go n input |
151 | 151 |
|
152 | | - err input = do alexSetInput input; lexError "error in nested comment" |
| 152 | + err input = do alexSetInput input; lexError "error in nested comment" |
153 | 153 |
|
154 | 154 | lexError s = do |
155 | 155 | (p,c,_,input) <- alexGetInput |
156 | | - alexError (showPosn p ++ ": " ++ s ++ |
| 156 | + alexError (showPosn p ++ ": " ++ s ++ |
157 | 157 | (if (not (null input)) |
158 | 158 | then " before " ++ show (head input) |
159 | 159 | else " at end of file")) |
160 | 160 |
|
161 | 161 | scanner str = runAlex str $ do |
162 | | - let loop i = do tok@(L _ cl _) <- alexMonadScan; |
| 162 | + let loop i = do tok@(L _ cl _) <- alexMonadScan; |
163 | 163 | if cl == LEOF |
164 | 164 | then return i |
165 | 165 | else do loop $! (i+1) |
|
0 commit comments