Return sensible Meta from ParseOccam failures.

This means we get the nice annotated source display on a parser failure --
although we still get not-very-useful descriptions of errors sometimes...
This commit is contained in:
Adam Sampson 2008-03-04 11:59:13 +00:00
parent 168628576d
commit 7ec6566495

View File

@ -2006,7 +2006,9 @@ sourceFile
runTockParser :: [Token] -> OccParser t -> CompState -> PassM t
runTockParser toks prod cs
= do case runParser prod ([], cs) "" toks of
Left err -> dieReport (Nothing, "Parse error: " ++ show err)
Left err ->
let m = sourcePosToMeta $ errorPos err
in dieReport (Just m, "Parse error: " ++ show err)
Right r -> return r
-- | Parse an occam program.