allow tabs in preprocessor directives

This commit is contained in:
Zachary Snow 2019-10-10 22:10:59 -04:00
parent 167c65db11
commit b660cfbd4e
1 changed files with 8 additions and 5 deletions

View File

@ -682,12 +682,15 @@ takeChar = do
dropSpaces :: Alex ()
dropSpaces = do
(pos, _, _, str) <- alexGetInput
case str of
' ' : rest -> do
alexSetInput (alexMove pos ' ', ' ', [], rest)
if null str then
return ()
else do
let ch : rest = str
if ch == '\t' || ch == ' ' then do
alexSetInput (alexMove pos ch, ch, [], tail str)
dropSpaces
[] -> return ()
_ -> return ()
else
return ()
isWhitespaceChar :: Char -> Bool
isWhitespaceChar ch = elem ch [' ', '\t', '\n']