Make HereDocPending only hold the relevant pieces of a T_HereDoc instead of an arbitrary Token
This commit is contained in:
parent
f242922a2e
commit
c97abdb939
|
@ -160,7 +160,7 @@ data Context =
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
data HereDocContext =
|
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)
|
deriving (Show)
|
||||||
|
|
||||||
data UserState = UserState {
|
data UserState = UserState {
|
||||||
|
@ -238,12 +238,12 @@ addToHereDocMap id list = do
|
||||||
hereDocMap = Map.insert id list map
|
hereDocMap = Map.insert id list map
|
||||||
}
|
}
|
||||||
|
|
||||||
addPendingHereDoc t = do
|
addPendingHereDoc id d q str = do
|
||||||
state <- getState
|
state <- getState
|
||||||
context <- getCurrentContexts
|
context <- getCurrentContexts
|
||||||
let docs = pendingHereDocs state
|
let docs = pendingHereDocs state
|
||||||
putState $ state {
|
putState $ state {
|
||||||
pendingHereDocs = HereDocPending t context : docs
|
pendingHereDocs = HereDocPending id d q str context : docs
|
||||||
}
|
}
|
||||||
|
|
||||||
popPendingHereDocs = do
|
popPendingHereDocs = do
|
||||||
|
@ -1835,7 +1835,7 @@ readHereDoc = called "here document" $ do
|
||||||
|
|
||||||
-- add empty tokens for now, read the rest in readPendingHereDocs
|
-- add empty tokens for now, read the rest in readPendingHereDocs
|
||||||
let doc = T_HereDoc hid dashed quoted endToken []
|
let doc = T_HereDoc hid dashed quoted endToken []
|
||||||
addPendingHereDoc doc
|
addPendingHereDoc hid dashed quoted endToken
|
||||||
return doc
|
return doc
|
||||||
where
|
where
|
||||||
unquote :: String -> (Quoted, String)
|
unquote :: String -> (Quoted, String)
|
||||||
|
@ -1856,7 +1856,7 @@ readPendingHereDocs = do
|
||||||
docs <- popPendingHereDocs
|
docs <- popPendingHereDocs
|
||||||
mapM_ readDoc docs
|
mapM_ readDoc docs
|
||||||
where
|
where
|
||||||
readDoc (HereDocPending (T_HereDoc id dashed quoted endToken _) ctx) =
|
readDoc (HereDocPending id dashed quoted endToken ctx) =
|
||||||
swapContext ctx $
|
swapContext ctx $
|
||||||
do
|
do
|
||||||
docStartPos <- getPosition
|
docStartPos <- getPosition
|
||||||
|
|
Loading…
Reference in New Issue