Skip to content

Commit a678c43

Browse files
authored
Merge pull request #131 from josephcsible/tabsize
Use div and mod identities to simplify tab size calculation
2 parents 75d0ab5 + b08a850 commit a678c43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/wrappers.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ alexStartPos :: AlexPosn
154154
alexStartPos = AlexPn 0 1 1
155155

156156
alexMove :: AlexPosn -> Char -> AlexPosn
157-
alexMove (AlexPn a l c) '\t' = AlexPn (a+1) l (((c+alex_tab_size-1) `div` alex_tab_size)*alex_tab_size+1)
157+
alexMove (AlexPn a l c) '\t' = AlexPn (a+1) l (c+alex_tab_size-((c-1) `mod` alex_tab_size))
158158
alexMove (AlexPn a l _) '\n' = AlexPn (a+1) (l+1) 1
159159
alexMove (AlexPn a l c) _ = AlexPn (a+1) l (c+1)
160160
#endif

0 commit comments

Comments
 (0)