Append input path name to UnknownNode errors

pull/185/head
5outh 2018-09-17 14:32:20 -04:00
parent 932cf70f9b
commit b2795482fa
1 changed files with 3 additions and 1 deletions

View File

@ -285,6 +285,8 @@ coreIO putErrorLnIO config suppressOutput inputPathM outputPathM =
return $ Right True
CPPModeNowarn -> return $ Right True
else return $ Right False
let
inputPathName = maybe "stdin" (("file " <>) . show) inputPathM
(parseResult, originalContents) <- case inputPathM of
Nothing -> do
-- TODO: refactor this hack to not be mixed into parsing logic
@ -382,7 +384,7 @@ coreIO putErrorLnIO config suppressOutput inputPathM outputPathM =
(ErrorInput str : _) -> do
putErrorLn $ "ERROR: parse error: " ++ str
uns@(ErrorUnknownNode{} : _) -> do
putErrorLn $ "ERROR: encountered unknown syntactical constructs:"
putErrorLn $ "ERROR: encountered unknown syntactical constructs when parsing " <> inputPathName <> ":"
uns `forM_` \case
ErrorUnknownNode str ast -> do
putErrorLn str