lib: reorder code for reading include files
This should be before all journal and parser state manipulations, so that those can be readily factored in a few commits time.
This commit is contained in:
parent
c6c412632b
commit
9e56ad24e2
@ -191,11 +191,6 @@ includedirectivep = do
|
||||
lift (skipSome spacenonewline)
|
||||
filename <- T.unpack <$> takeWhileP Nothing (/= '\n') -- don't consume newline yet
|
||||
|
||||
-- save parent state
|
||||
parentParserState <- getParserState
|
||||
parentj <- get
|
||||
|
||||
let childj = newJournalWithParseStateFrom parentj
|
||||
parentpos <- getPosition
|
||||
|
||||
-- read child input
|
||||
@ -203,6 +198,12 @@ includedirectivep = do
|
||||
filepath <- lift $ expandPath curdir filename `orRethrowIOError` (show parentpos ++ " locating " ++ filename)
|
||||
childInput <- lift $ readFilePortably filepath `orRethrowIOError` (show parentpos ++ " reading " ++ filepath)
|
||||
|
||||
-- save parent state
|
||||
parentParserState <- getParserState
|
||||
parentj <- get
|
||||
|
||||
let childj = newJournalWithParseStateFrom parentj
|
||||
|
||||
-- set child state
|
||||
setInput childInput
|
||||
pushPosition $ initialPos filepath
|
||||
|
||||
Loading…
Reference in New Issue
Block a user