Remove unused here doc boundary concept.
This commit is contained in:
parent
1d0db9267d
commit
81978d15bd
|
@ -144,7 +144,6 @@ data Context =
|
||||||
|
|
||||||
data HereDocContext =
|
data HereDocContext =
|
||||||
HereDocPending Token -- on linefeed, read this T_HereDoc
|
HereDocPending Token -- on linefeed, read this T_HereDoc
|
||||||
| HereDocBoundary -- but don't consider heredocs before this
|
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
data UserState = UserState {
|
data UserState = UserState {
|
||||||
|
@ -193,30 +192,6 @@ addToHereDocMap id list = do
|
||||||
hereDocMap = Map.insert id list map
|
hereDocMap = Map.insert id list map
|
||||||
}
|
}
|
||||||
|
|
||||||
withHereDocBoundary p = do
|
|
||||||
pushBoundary
|
|
||||||
do
|
|
||||||
v <- p
|
|
||||||
popBoundary
|
|
||||||
return v
|
|
||||||
<|> do
|
|
||||||
popBoundary
|
|
||||||
fail ""
|
|
||||||
where
|
|
||||||
pushBoundary = do
|
|
||||||
state <- getState
|
|
||||||
let docs = pendingHereDocs state
|
|
||||||
putState $ state {
|
|
||||||
pendingHereDocs = HereDocBoundary : docs
|
|
||||||
}
|
|
||||||
popBoundary = do
|
|
||||||
state <- getState
|
|
||||||
let docs = tail $ dropWhile (not . isHereDocBoundary) $
|
|
||||||
pendingHereDocs state
|
|
||||||
putState $ state {
|
|
||||||
pendingHereDocs = docs
|
|
||||||
}
|
|
||||||
|
|
||||||
addPendingHereDoc t = do
|
addPendingHereDoc t = do
|
||||||
state <- getState
|
state <- getState
|
||||||
let docs = pendingHereDocs state
|
let docs = pendingHereDocs state
|
||||||
|
@ -226,18 +201,14 @@ addPendingHereDoc t = do
|
||||||
|
|
||||||
popPendingHereDocs = do
|
popPendingHereDocs = do
|
||||||
state <- getState
|
state <- getState
|
||||||
let (pending, boundary) = break isHereDocBoundary $ pendingHereDocs state
|
let pending = pendingHereDocs state
|
||||||
putState $ state {
|
putState $ state {
|
||||||
pendingHereDocs = boundary
|
pendingHereDocs = []
|
||||||
}
|
}
|
||||||
return . map extract . reverse $ pendingHereDocs state
|
return . map extract . reverse $ pendingHereDocs state
|
||||||
where
|
where
|
||||||
extract (HereDocPending t) = t
|
extract (HereDocPending t) = t
|
||||||
|
|
||||||
isHereDocBoundary x = case x of
|
|
||||||
HereDocBoundary -> True
|
|
||||||
otherwise -> False
|
|
||||||
|
|
||||||
getMap = positionMap <$> getState
|
getMap = positionMap <$> getState
|
||||||
getParseNotes = parseNotes <$> getState
|
getParseNotes = parseNotes <$> getState
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue