proper handling of single-line comments in macro definitions

This commit is contained in:
Zachary Snow 2019-03-29 19:08:44 -04:00
parent c4449fd9ca
commit 17fd6f8ce5
1 changed files with 5 additions and 0 deletions

View File

@ -410,6 +410,11 @@ takeUntilNewline = do
[] -> return "" [] -> return ""
'\n' : _ -> do '\n' : _ -> do
return "" return ""
'/' : '/' : _ -> do
remainder <- takeThrough '\n'
case last $ init remainder of
'\\' -> takeUntilNewline >>= return . (' ' :)
_ -> return ""
'\\' : '\n' : rest -> do '\\' : '\n' : rest -> do
let newPos = alexMove (alexMove pos '\\') '\n' let newPos = alexMove (alexMove pos '\\') '\n'
alexSetInput (newPos, '\n', [], rest) alexSetInput (newPos, '\n', [], rest)