diff --git a/src/Lexer.hs b/src/Lexer.hs index 3e98cce..273a0fe 100644 --- a/src/Lexer.hs +++ b/src/Lexer.hs @@ -221,7 +221,7 @@ link :: Lexer link = do pos <- getPosition l <- linkRaw - -- "unconsume" the last token + -- register the position of the last token pos' <- flip incSourceColumn (-1) <$> getPosition pure $ (pos, LinkOpen) : l <> [(pos', LinkClose)] diff --git a/test/Spec.hs b/test/Spec.hs index 8207b77..a09489e 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -11,6 +11,7 @@ import Types import Data.String (IsString (..)) import Data.Text (Text) import Text.Parsec.Pos +import GHC.Stack main :: IO () main = hspec $ do @@ -186,6 +187,7 @@ instance IsString (Doc String) where shouldLexTo :: String -> [(Int, Int, Token)] -> Expectation shouldLexTo input expected = + withFrozenCallStack $ case lexer input of Right tokens -> do let actual = map (\(pos, tok) -> (sourceLine pos, sourceColumn pos, tok)) tokens