From 17fd6f8ce567bca6f569b9902d5c6c359975b598 Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Fri, 29 Mar 2019 19:08:44 -0400 Subject: [PATCH] proper handling of single-line comments in macro definitions --- src/Language/SystemVerilog/Parser/Lex.x | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Language/SystemVerilog/Parser/Lex.x b/src/Language/SystemVerilog/Parser/Lex.x index f2879bc..a379e10 100644 --- a/src/Language/SystemVerilog/Parser/Lex.x +++ b/src/Language/SystemVerilog/Parser/Lex.x @@ -410,6 +410,11 @@ takeUntilNewline = do [] -> return "" '\n' : _ -> do return "" + '/' : '/' : _ -> do + remainder <- takeThrough '\n' + case last $ init remainder of + '\\' -> takeUntilNewline >>= return . (' ' :) + _ -> return "" '\\' : '\n' : rest -> do let newPos = alexMove (alexMove pos '\\') '\n' alexSetInput (newPos, '\n', [], rest)