From c97abdb939a52beefa576d984b104eb89e7667d9 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Tue, 19 Dec 2023 00:41:12 -0500 Subject: [PATCH] Make HereDocPending only hold the relevant pieces of a T_HereDoc instead of an arbitrary Token --- src/ShellCheck/Parser.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 701010fd2..0e2fc6d34 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -160,7 +160,7 @@ data Context = deriving (Show) data HereDocContext = - HereDocPending Token [Context] -- on linefeed, read this T_HereDoc + HereDocPending Id Dashed Quoted String [Context] -- on linefeed, read this T_HereDoc deriving (Show) data UserState = UserState { @@ -238,12 +238,12 @@ addToHereDocMap id list = do hereDocMap = Map.insert id list map } -addPendingHereDoc t = do +addPendingHereDoc id d q str = do state <- getState context <- getCurrentContexts let docs = pendingHereDocs state putState $ state { - pendingHereDocs = HereDocPending t context : docs + pendingHereDocs = HereDocPending id d q str context : docs } popPendingHereDocs = do @@ -1835,7 +1835,7 @@ readHereDoc = called "here document" $ do -- add empty tokens for now, read the rest in readPendingHereDocs let doc = T_HereDoc hid dashed quoted endToken [] - addPendingHereDoc doc + addPendingHereDoc hid dashed quoted endToken return doc where unquote :: String -> (Quoted, String) @@ -1856,7 +1856,7 @@ readPendingHereDocs = do docs <- popPendingHereDocs mapM_ readDoc docs where - readDoc (HereDocPending (T_HereDoc id dashed quoted endToken _) ctx) = + readDoc (HereDocPending id dashed quoted endToken ctx) = swapContext ctx $ do docStartPos <- getPosition