Skip to content

Commit 0911f92

Browse files
committed
Fix build
I missed how the GHC-specific meta-CPP only works within `#ifdef ALEX_GHC`.
1 parent dabc776 commit 0911f92

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

templates/GenericTemplate.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ uncheckedShiftL# = shiftL#
5858
ALEX_ENDIF
5959

6060
{-# INLINE alexIndexInt16OffAddr #-}
61+
alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int#
6162
alexIndexInt16OffAddr (AlexA# arr) off =
6263
ALEX_IF_BIGENDIAN
64+
ALEX_IF_GHC_GT_901
6365
narrow16Int# i
66+
ALEX_ELSE
67+
int16ToInt# i
68+
ALEX_ENDIF
6469
where
6570
i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
6671
high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
@@ -75,9 +80,14 @@ alexIndexInt16OffAddr arr off = arr ! off
7580

7681
#ifdef ALEX_GHC
7782
{-# INLINE alexIndexInt32OffAddr #-}
83+
alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int#
7884
alexIndexInt32OffAddr (AlexA# arr) off =
7985
ALEX_IF_BIGENDIAN
86+
ALEX_IF_GHC_GT_901
8087
narrow32Int# i
88+
ALEX_ELSE
89+
int32ToInt# i
90+
ALEX_ENDIF
8191
where
8292
i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`
8393
(b2 `uncheckedShiftL#` 16#) `or#`
@@ -164,23 +174,13 @@ alex_scan_tkn user__ orig_input len input__ s last_acc =
164174
#endif
165175
case fromIntegral c of { IBOX(ord_c) ->
166176
let
167-
ALEX_IF_GHC_GT_901
168-
base = int32ToInt# (alexIndexInt32OffAddr alex_base s)
169-
offset = PLUS(base,ord_c)
170-
check = int16ToInt# (alexIndexInt16OffAddr alex_check offset)
171-
172-
new_s = if GTE(offset,ILIT(0)) && EQ(check,ord_c)
173-
then int16ToInt# (alexIndexInt16OffAddr alex_table offset)
174-
else int16ToInt# (alexIndexInt16OffAddr alex_deflt s)
175-
ALEX_ELSE
176177
base = alexIndexInt32OffAddr alex_base s
177178
offset = PLUS(base,ord_c)
178179
check = alexIndexInt16OffAddr alex_check offset
179180

180181
new_s = if GTE(offset,ILIT(0)) && EQ(check,ord_c)
181182
then alexIndexInt16OffAddr alex_table offset
182183
else alexIndexInt16OffAddr alex_deflt s
183-
ALEX_ENDIF
184184
in
185185
case new_s of
186186
ILIT(-1) -> (new_acc, input__)

0 commit comments

Comments
 (0)