Skip to content

Commit b82bdd1

Browse files
ZichaoNickFoxandreasabel
authored andcommitted
Debugging lexer: print character in addition to its ASCII code
Coauthored-by: ZichaoNickFox <[email protected]> Coauthored-by: Andreas Abel <[email protected]>
1 parent b0acbff commit b82bdd1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

data/AlexTemplate.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ alex_scan_tkn user__ orig_input len input__ s last_acc =
155155
Nothing -> (new_acc, input__)
156156
Just (c, new_input) ->
157157
#ifdef ALEX_DEBUG
158-
trace ("State: " ++ show IBOX(s) ++ ", char: " ++ show c) $
158+
trace ("State: " ++ show IBOX(s) ++ ", char: " ++ show c ++ " " ++ (show . chr . fromIntegral) c) $
159159
#endif
160160
case fromIntegral c of { IBOX(ord_c) ->
161161
let

src/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ import_glaexts = "#if __GLASGOW_HASKELL__ >= 503\n" ++
406406

407407
import_debug :: String
408408
import_debug = "#if __GLASGOW_HASKELL__ >= 503\n" ++
409+
"import Data.Char (chr)\n" ++
409410
"import System.IO\n" ++
410411
"import System.IO.Unsafe\n" ++
411412
"import Debug.Trace\n" ++

0 commit comments

Comments
 (0)